package poker;

import static org.junit.Assert.*;

import org.junit.Test;

public class StudentTests {

	@Test
	public void testSingleTest() {
		Card[] testHand = new Card[5];
		testHand[0] = new Card(1,1);
		testHand[1] = new Card(2,1);
		testHand[2] = new Card(3,1);
		testHand[3] = new Card(4,3);
		testHand[4] = new Card(5,1);
		assertFalse(PokerHandEvaluator.hasPair(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(1,1);
		testHand1[1] = new Card(2,1);
		testHand1[2] = new Card(3,1);
		testHand1[3] = new Card(3,3);
		testHand1[4] = new Card(5,1);
		assertTrue(PokerHandEvaluator.hasPair(testHand1));
		
		
	}
	
    @Test
	public void testHasRainbow(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(1,0);
		testHand[1] = new Card(2,3);
		testHand[2] = new Card(3,2);
		testHand[3] = new Card(3,1);
		testHand[4] = new Card(3,2);
		assertTrue(PokerHandEvaluator.hasRainbow(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(1,1);
		testHand1[1] = new Card(5,3);
		testHand1[2] = new Card(2,1);
		testHand1[3] = new Card(4,3);
		testHand1[4] = new Card(3,2);
		assertFalse(PokerHandEvaluator.hasRainbow(testHand1));
		
	}
    @Test
    public void testHasTwoPair(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(1,1);
		testHand[1] = new Card(1,3);
		testHand[2] = new Card(4,2);
		testHand[3] = new Card(3,1);
		testHand[4] = new Card(3,2);
		assertTrue(PokerHandEvaluator.hasTwoPair(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(1,1);
		testHand1[1] = new Card(1,3);
		testHand1[2] = new Card(4,2);
		testHand1[3] = new Card(1,2);
		testHand1[4] = new Card(3,2);
		assertFalse(PokerHandEvaluator.hasTwoPair(testHand1));
		
		
		Card[] testHand2 = new Card[5];
		testHand2[0] = new Card(1,1);
		testHand2[1] = new Card(1,3);
		testHand2[2] = new Card(4,2);
		testHand2[3] = new Card(1,2);
		testHand2[4] = new Card(4,2);
		System.out.print(PokerHandEvaluator.hasTwoPair(testHand2));
		
		assertTrue(PokerHandEvaluator.hasTwoPair(testHand2));
		
	}
    
    @Test
    public void testHasFlush(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(1,1);
		testHand[1] = new Card(11,1);
		testHand[2] = new Card(2,1);
		testHand[3] = new Card(9,1);
		testHand[4] = new Card(3,1);
		assertTrue(PokerHandEvaluator.hasFlush(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(3,0);
		testHand1[1] = new Card(5,1);
		testHand1[2] = new Card(9,0);
		testHand1[3] = new Card(7,1);
		testHand1[4] = new Card(11,1);
		assertFalse(PokerHandEvaluator.hasFlush(testHand1));
		
	}
    @Test
    public void testHasOddStraight(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(1,1);
		testHand[1] = new Card(3,1);
		testHand[2] = new Card(5,3);
		testHand[3] = new Card(9,1);
		testHand[4] = new Card(7,0);
		assertTrue(PokerHandEvaluator.hasOddStraight(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(1,1);
		testHand1[1] = new Card(3,1);
		testHand1[2] = new Card(5,3);
		testHand1[3] = new Card(11,1);
		testHand1[4] = new Card(7,0);
		assertFalse(PokerHandEvaluator.hasOddStraight(testHand1));
		
		Card[] testHand2 = new Card[5];
		testHand2[0] = new Card(11,1);
		testHand2[1] = new Card(3,1);
		testHand2[2] = new Card(5,3);
		testHand2[3] = new Card(9,1);
		testHand2[4] = new Card(7,0);
		assertTrue(PokerHandEvaluator.hasOddStraight(testHand2));
		
		
	}
    
    @Test
    public void testHasEvenStraight(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(2,1);
		testHand[1] = new Card(6,1);
		testHand[2] = new Card(4,3);
		testHand[3] = new Card(8,1);
		testHand[4] = new Card(12,0);
		assertFalse(PokerHandEvaluator.hasEvenStraight(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(1,1);
		testHand1[1] = new Card(6,1);
		testHand1[2] = new Card(8,3);
		testHand1[3] = new Card(10,1);
		testHand1[4] = new Card(12,0);
		assertTrue(PokerHandEvaluator.hasEvenStraight(testHand1));
	}
    
    @Test
    public void testHasFullHouse(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(2,1);
		testHand[1] = new Card(2,0);
		testHand[2] = new Card(2,3);
		testHand[3] = new Card(8,1);
		testHand[4] = new Card(8,0);
		assertTrue(PokerHandEvaluator.hasFullHouse(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(2,1);
		testHand1[1] = new Card(2,0);
		testHand1[2] = new Card(8,3);
		testHand1[3] = new Card(8,1);
		testHand1[4] = new Card(8,0);
		assertTrue(PokerHandEvaluator.hasFullHouse(testHand1));
		
		Card[] testHand2 = new Card[5];
		testHand2[0] = new Card(2,1);
		testHand2[1] = new Card(2,0);
		testHand2[2] = new Card(2,3);
		testHand2[3] = new Card(2,1);
		testHand2[4] = new Card(8,0);
		assertFalse(PokerHandEvaluator.hasFullHouse(testHand2));
		
		Card[] testHand3 = new Card[5];
		testHand3[0] = new Card(2,1);
		testHand3[1] = new Card(1,0);
		testHand3[2] = new Card(2,3);
		testHand3[3] = new Card(3,1);
		testHand3[4] = new Card(8,0);
		assertFalse(PokerHandEvaluator.hasFullHouse(testHand3));
		
	}
    
    @Test
    public void testHasFourOfAKind(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(1,2);
		testHand[1] = new Card(1,0);
		testHand[2] = new Card(1,3);
		testHand[3] = new Card(1,1);
		testHand[4] = new Card(12,0);
		assertTrue(PokerHandEvaluator.hasFourOfAKind(testHand));
		
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(1,2);
		testHand1[1] = new Card(1,0);
		testHand1[2] = new Card(4,3);
		testHand1[3] = new Card(2,1);
		testHand1[4] = new Card(12,0);
		assertFalse(PokerHandEvaluator.hasFourOfAKind(testHand1));
		
	}
    
    @Test
    public void testStraightRainbow(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(3,1);
		testHand[1] = new Card(5,0);
		testHand[2] = new Card(9,3);
		testHand[3] = new Card(7,1);
		testHand[4] = new Card(11,2);
		assertTrue(PokerHandEvaluator.hasStraightRainbow(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(3,1);
		testHand1[1] = new Card(5,1);
		testHand1[2] = new Card(9,3);
		testHand1[3] = new Card(7,1);
		testHand1[4] = new Card(11,2);
		assertFalse(PokerHandEvaluator.hasStraightRainbow(testHand1));
		
		Card[] testHand2 = new Card[5];
		testHand2[0] = new Card(3,1);
		testHand2[1] = new Card(5,0);
		testHand2[2] = new Card(9,0);
		testHand2[3] = new Card(7,1);
		testHand2[4] = new Card(11,2);
		assertFalse(PokerHandEvaluator.hasStraightRainbow(testHand2));
	}
    
    
    @Test
    public void testStraightFlush(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(3,1);
		testHand[1] = new Card(5,1);
		testHand[2] = new Card(9,1);
		testHand[3] = new Card(7,1);
		testHand[4] = new Card(11,1);
		assertTrue(PokerHandEvaluator.hasStraightFlush(testHand));
		
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(3,0);
		testHand1[1] = new Card(5,1);
		testHand1[2] = new Card(9,0);
		testHand1[3] = new Card(7,1);
		testHand1[4] = new Card(11,1);
		assertFalse(PokerHandEvaluator.hasStraightFlush(testHand1));
		
	}
    
    @Test
    public void testThreeOfAKind(){
		Card[] testHand = new Card[5];
		testHand[0] = new Card(3,1);
		testHand[1] = new Card(2,1);
		testHand[2] = new Card(3,0);
		testHand[3] = new Card(3,2);
		testHand[4] = new Card(11,2);
		assertTrue(PokerHandEvaluator.hasThreeOfAKind(testHand));
		
		Card[] testHand1 = new Card[5];
		testHand1[0] = new Card(3,1);
		testHand1[1] = new Card(3,1);
		testHand1[2] = new Card(3,0);
		testHand1[3] = new Card(3,2);
		testHand1[4] = new Card(11,2);
		assertTrue(PokerHandEvaluator.hasThreeOfAKind(testHand1));
	}  
	}


